<?php 
require '../../config.php';
$codigo = mysql_real_escape_string($_POST['codigoplan']);  
$result = mysql_query("select idruta from planes where idplanes  = '". $codigo ."' limit 1");  
if(mysql_num_rows($result)>0)
{  
	$row = mysql_fetch_array($result);
	echo($row['idruta']);			
}
else
{  
	echo -1;  
}
?> 